/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package mahoamd5;

import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

/**
 *
 * @author PC-PC
 */
public class MahoaMD5 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
    }
    public boolean isValidAccount(String userName, String password) {
        String hashtext = convertMD5(password);
        System.out.println("password MD5: " + hashtext);
//        if (checkMember(userName, hashtext) > 0) {
//            return true;
//        }
        return false;
    }
    public static String convertMD5(String password) {
        try {
            MessageDigest md = MessageDigest.getInstance("MD5");
            md.update(password.getBytes());
            byte[] digit = md.digest();
            BigInteger bigInt = new BigInteger(1, digit);
            String hashtext = bigInt.toString(16);
            return hashtext;

        } catch (NoSuchAlgorithmException e) {
        } catch (NullPointerException ex) {
            System.out.println(ex);
        }
        return null;
    }
    
}
